home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / print / hpgl2ps.zip / EXT.H < prev    next >
C/C++ Source or Header  |  1989-08-08  |  3KB  |  130 lines

  1. /*
  2.  *
  3.  *    The following definations allow for the efficient 
  4.  *    translation of DXY and RD-GL codes to PostScript code
  5.  *
  6.  */
  7.  
  8. #include <stdio.h>
  9. #include <math.h>
  10. #include <ctype.h>
  11.  
  12. #define CR    '\015'
  13. #define LF    '\012'
  14. #define SPACE    '\040'
  15.  
  16. /* the definition below was modified by Gordon Jacobs to remove
  17.  * the validity of a comma in a Signed Numeric quantity. The
  18.  * definition below is more accurate and the comma is now removed
  19.  * after reading the digit in getval()
  20.  */
  21. #define SIGNED_NUMERIC  (ungetc(( ch = getc(stream)),stream) != EOF ) &&\
  22.         (((ch>='0') && (ch<='9')) || (ch=='-') || (ch=='+')\
  23.         || (ch==' ') || (ch == '.'))
  24.  
  25. #define CIRCLE    21        /* DXY Circle */
  26. #define RCIRCLE 22        /* DXY Relative Circle */
  27. #define CCIRCLE 23        /* DXY Centered Circle */
  28. #define ACIRCLE 24        /* DXY Arc plus Circle */
  29. #define SCIRCLE 25        /* DXY Segment Circle */
  30. #define RDGLCIRCLE 26        /* RD-GL Circle */
  31.  
  32. #define TEXT    31
  33. #define MARK    32
  34.  
  35. #define LINETYPE    41
  36. #define LINESCALE    42
  37. #define LINE_TYPE_SCALE    43
  38.  
  39. #define XTICK 0
  40. #define YTICK 1
  41. /*
  42.  *    Files to open if any
  43.  */
  44. FILE    *stream;
  45. FILE    *fopen();
  46. /*
  47.  *    Plotting Parameters that will contain the necessary PostScript
  48.  *    commands to plot (see dxy2ps.c for the initialisation) and
  49.  *    ps_macros.c for the plotting macros).
  50.  */
  51. char    *MOVE;
  52. char    *RMOVE;
  53. char    *DRAW;
  54. char    *RDRAW;
  55. /*
  56.  *    Definition of "ch" used in SIGNED_NUMERIC
  57.  */
  58. char    ch;
  59. /*
  60.  *    Define the function getval() which returns a real number.
  61.  */
  62. float    getval();
  63. /*
  64.  *    Scaling parameters used for translation from DXY and RD-GL
  65.  *    coordinate sytem to the PostScript coordinate system which
  66.  *    has been defined in millimeters. (See above)
  67.  */
  68. float    SCALE;
  69. float    XSCALE;
  70. float    YSCALE;
  71. float    xmax, xmin;
  72. float    ymax, ymin;
  73. float   psxmax,psymax;  /* max postscript dimensions */
  74. float   tlp,tln;      /* HP-GL tick length parameters */
  75. float   FONT_H_MULT;    /* fudge factor for font height */
  76. float   FONT_W_MULT;    /* fudge factor for font width */
  77. /*
  78.  *    End of line terminator (RD-GL / HP-GL)
  79.  */
  80. char    EOL;
  81. /*
  82.  *    PostScript Coordinate parameters
  83.  */
  84. float    lastXmove;
  85. float    lastYmove;
  86. float    absX;
  87. float    absY;
  88. float   offX,offY;   /* used for Scale command */
  89. float    xval;
  90. float    yval;
  91. float    xoffset, yoffset;
  92. /*
  93.  *    Extra parameters
  94.  */
  95. float    char_angle;
  96. float    char_height;
  97. float    char_width;
  98. float    char_space;
  99. float    char_slant;
  100.  
  101. char    *font;
  102.  
  103. char    symbl;
  104.  
  105. int    dcount;
  106. /*
  107.  *    Degree radian conversion parameter ie: deg_rad = asin(1) / 90.0;
  108.  *    ( Defined in dxy2ps.c or rdgl2ps.c )
  109.  */
  110. float    deg_rad;
  111. /*
  112.  *    Line / pen size parameter (max 9 sizes)
  113.  */
  114. float    pen_size[9];
  115. int     pen_number;
  116. /*
  117.  *    Paper size (ie A3 or A4) and Mode (HPGL or DXY)
  118.  */
  119. char    *PaperSize;
  120. char    *Mode;
  121. /*
  122.  *    Flags
  123.  */
  124. int    LANDSCAPE;
  125. int    DRAW_FLAG;
  126. int    PLOTABS;
  127. int    PENDOWN;
  128. int    SETDOT;     /* HP-GL commands only */
  129. int    SYMBOL;        /* HP-GL commands only */
  130.